package com.zz.repository;

import java.sql.Types;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class DTODao {
	@Resource
	private JdbcTemplate jdbcTemplate;
	
	public List<Map<String, Object>> getlistexcel(){
		String sql="select del.id,pr.name as productname,del.out_num,del.out_time,s.name as gysname,w.name as ckname,del.notes from deliverylist as del left join product pr on (del.product_id=pr.id) left join supplier s on (del.supplier_id=s.id) left join ware w on (del.ware_id=w.id)";
		return jdbcTemplate.queryForList(sql);
	}
	
	public List<Map<String, Object>> getPoexcel(String poid){
		String sql="select p.id,p.product_id,pr.name as prname,p.po_time,p.po_num,p.entry_id,p.status,s.name as gysname,p.returns_id from po as p left join product pr on (p.product_id=pr.id) left join supplier s on (s.id=pr.supplier_id) where p.id=?";
		Object[] args = { poid };
		int[] argTypes = { Types.VARCHAR };
		return jdbcTemplate.queryForList(sql,args,argTypes);
	}
		
}
